dict1 = {'name': 'TOM', 'age': 20, 'gender': '男'}

# key的遍历
for key in dict1.keys():
    print(key)
print('===================')

for i in dict1:  # 此时，默认返回所有的 键,列表形式
    print(i)
print('===================')

# value的遍历
print(type(dict1.values()))  # <class 'dict_values'>
for value in dict1.values():
    print(value)
print('===================')

# 键值对的遍历
for item in dict1.items():
    print(item)

print(list(dict1.items()))  # 转换之后的列表元素是由元组组成
print('===================')

# 键值对的拆包
for key, value in dict1.items():
    print(f'{key} = {value}')
